package com.pansoft.kline.greendao;

import android.content.Context;

import com.github.yuweiguocn.library.greendao.MigrationHelper;
import com.pansoft.kline.model.ConfigCoinBean;
import com.pansoft.kline.model.ConfigFutureBean;
import com.pansoft.kline.model.ConfigSiteBean;
import com.pansoft.kline.model.SelfSelectedBean;

import org.greenrobot.greendao.database.Database;

public class MySQLiteOpenHelper extends DaoMaster.OpenHelper {

    public MySQLiteOpenHelper(Context context, String name) {
        super(context, name);
    }

    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
        MigrationHelper.migrate(db, new MigrationHelper.ReCreateAllTableListener() {
            @Override
            public void onCreateAllTables(Database db, boolean ifNotExists) {
                DaoMaster.createAllTables(db, ifNotExists);
            }
            @Override
            public void onDropAllTables(Database db, boolean ifExists) {
                DaoMaster.dropAllTables(db, ifExists);
            }
        },ConfigCoinBeanDao.class, ConfigFutureBeanDao.class, ConfigMarketBeanDao.class,
                ConfigSiteBeanDao.class, SelfSelectedBeanDao.class);
    }
}
